﻿<Window x:Class="DynamicMVVM.Demo.UI.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="768" Width="1024">
    <Grid Name="RootContent"
          SnapsToDevicePixels="True">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="5*" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition  />
            <RowDefinition Height="20*" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Grid.ColumnSpan="3">
            <Menu ItemsSource="{Binding MenuItems}" HorizontalContentAlignment="Stretch" >
                <Menu.ItemContainerStyle>
                    <Style TargetType="MenuItem">
                        <Setter Property="Command"
                                Value="{Binding Command}" />
                        <Setter Property="CommandParameter"
                                Value="{Binding CommandParameter}" />
                        <Setter Property="Header"
                                Value="{Binding Header}" />
                        <Setter Property="ItemsSource"
                                Value="{Binding Items}" />
                    </Style>
                </Menu.ItemContainerStyle>
            </Menu>

        </StackPanel>

        <ContentControl x:Name="MainControl" Content="{Binding DisplayedControl}" Grid.Row="1" Grid.Column="1"/>
        
        <StatusBar x:Name="MainStatusBar"
                   Grid.Row="2"
                   Grid.ColumnSpan="3"
                   DataContext="{Binding StatusViewModel}">
            <StatusBar.ItemsPanel>
                <ItemsPanelTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="2" />
                        </Grid.ColumnDefinitions>
                    </Grid>
                </ItemsPanelTemplate>
            </StatusBar.ItemsPanel>

            <StatusBarItem Grid.Column="0">
                <TextBlock Text="{Binding StatusMessage}"
                           IsHyphenationEnabled="False"
                           TextTrimming="CharacterEllipsis"></TextBlock>
            </StatusBarItem>

        </StatusBar>
    </Grid>
</Window>
